<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%><%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String clientCookie = request.getHeader("Cookie");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Web截屏控件2演示界面</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link type="text/css" rel="Stylesheet" href="zyCapture/skygqbox.css" />
    <script type="text/javascript" src="zyCapture/jquery-1.7.2.min.js" charset="utf-8"></script>
    <script type="text/javascript" src="zyCapture/json2.min.js" charset="utf-8"></script>
    <script type="text/javascript" src="zyCapture/skygqbox.js" charset="utf-8"></script>
    <script type="text/javascript" src="zyCapture/scp.js" charset="utf-8"></script>
</head>
<body>
    <div id="msg"></div>
	<div id="ScreenCaptureDiv">
		<input id="BtnCapture" type="button" value="截取屏幕区域" />
        <input id="BtnCapture2" type="button" value="截屏时隐藏当前窗口" />
        <input id="BtnCapture3" type="button" value="截取全屏" />
        <input id="BtnCapture6" type="button" value="截取全屏（编辑）" />
        <input id="BtnCapture4" type="button" value="截取指定区域" />
        <input id="BtnCapture5" type="button" value="粘贴" />
		<img id="ScreenImg" alt="截屏图片" style="display: none" />
	</div>
	<script type="text/javascript" language="javascript">
		//根路径：http://localhost/api/scp/
        var pos = window.location.href.lastIndexOf("/");
        var api = [
            window.location.href.substr(0, pos + 1),
            "upload.jsp"
        ].join("");
		
		var scp = zyCapture.getInstance({
	        config: {
                PostUrl: api,
                Cookie: '<%=clientCookie%>',
                Fields: { uname: "test" }
            },
	        event:{
	            hotKey:function(){
	                setTimeout(function () {
	                    scp.Capture2();
	                }, 100);
	            },
	            postComplete:function(url){
	                $("#ScreenImg").attr("src", url + "?t="+new Date().getTime() );
	                $("#ScreenImg").show();
	            }
	        }
	    });

		$( function ()
		{
            $("#BtnCapture").click(function () { scp.Capture(); });
            $("#BtnCapture2").click(function () { scp.CaptureHide(); });
            $("#BtnCapture3").click(function () { scp.CaptureScreen(); });
            $("#BtnCapture6").click(function () { scp.CaptureScreen(true); });
		    $("#BtnCapture4").click(function () { scp.CaptureRect(0, 0, 100, 100); });
            $("#BtnCapture5").click(function () { scp.Paste(); });
		});
	</script>
</body>
</html>